user www-data;
worker_processes auto;
pid /run/nginx.pid;

events {
    worker_connections 2048;
    multi_accept on;
    use epoll;
}

http {
    # Main settings
    client_body_buffer_size         4m;
    client_body_timeout             60s;
    client_header_buffer_size       2k;
    client_header_timeout           60s;
    client_max_body_size            20m;
    keepalive_timeout               60s;
    large_client_header_buffers     4   8k;
    reset_timedout_connection       on;
    send_timeout                    60s;
    sendfile                        on;
    server_name_in_redirect         off;
    server_names_hash_bucket_size   512;
    server_names_hash_max_size      512;
    server_tokens                   off;
    tcp_nodelay                     on;
    tcp_nopush                      on;
    types_hash_max_size             2048;
    merge_slashes                   off;
    error_log                       /var/log/nginx/default-error.log;
    access_log                      /var/log/nginx/default-access.log;

    include                         /etc/nginx/mime.types;
    default_type                    application/octet-stream;

    # Compression
    gzip                on;
    gzip_static         on;
    gzip_vary           on;
    gzip_comp_level     6;
    gzip_min_length     512;
    gzip_buffers        8 64k;
    gzip_types          text/plain text/css text/javascript text/js text/xml application/json application/javascript application/x-javascript application/xml application/xml+rss application/x-font-ttf image/svg+xml font/opentype;
    gzip_proxied        any;
    gzip_disable        "msie6";
    gzip_http_version   1.0;

    # Log format
    log_format postdata '$remote_addr - $remote_user [$time_local] "$request" $status $bytes_sent "$http_referer" "$http_user_agent" "$request_body"';

    # File cache settings
    open_file_cache          max=10000 inactive=30s;
    open_file_cache_valid    60s;
    open_file_cache_min_uses 2;
    open_file_cache_errors   off;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-available/*;
}

daemon off;